<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>

<c:if test="${not empty errors}">
	<div class="error" id="ErrorPopUp">
		<div class="hd">
			Errores
		</div>

		<div class="bd">
			<ul>
				<c:forEach var="error" items="${errors}">
					<li class="mensajeError"><c:out value="${error.defaultMessage}" escapeXml="false" /></li>
				</c:forEach>
			</ul>
		</div>
	</div>
</c:if>

<SCRIPT LANGUAGE="JavaScript">

	YAHOO.util.Event.addListener(window, "load", mostrarErrores());	
	//Muestra los errores si es que existen.
	function mostrarErrores(){ 
		if (document.getElementById('ErrorPopUp') != null) {
				var handleOK = function() {
					this.cancel();
				};
				
				var errorPopUp = new YAHOO.widget.SimpleDialog("ErrorPopUp", { 
					modal: true, 
					visible:false, 
					constraintoviewport:true, 
					fixedcenter: true,
					buttons: [ { text:"Aceptar", handler:handleOK, isDefault:true} ]					 
				}); 
				
				errorPopUp.render();
				errorPopUp.show();
		}
	}
	
</script>
